package com.company.arithmetic;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

/**
 * Created by v on 16-12-15.
 */
public class ClosestApproach {
    static int n;
    static Point[] points;


    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        n=input.nextInt();
        points=new Point[n];
        for(int i=0;i<n;i++){
            points[i]=new Point(input.nextInt(),input.nextInt());
        }

        Arrays.sort(points, new Comparator<Point>() {
            @Override
            public int compare(Point o1, Point o2) {
                if(o1.x>o2.x){
                    return 1;
                }else if(o1.x==o2.x){
                    return 0;
                }else {
                    return -1;
                }
            }
        });

        double minDistance=minDistance(0,n-1);
        System.out.println(minDistance);
    }

    private static class Point{
        int x;
        int y;

        public Point(int x,int y){
            this.x=x;
            this.y=y;
        }
    }

    private static double distance(Point p1,Point p2){
        return Math.pow(Math.pow(p1.x-p2.x,2)
                +Math.pow(p1.y-p2.y,2),0.5);
    }

    private static double minDistance(int begin,int end){
        if(begin==end){
            return 0xFFFFFFF;
        }else if(end-begin==1){
            distance(points[begin],points[end]);
        }

        int center=(begin+end)/2;

        double dLeft=minDistance(begin,center);
        double dright=minDistance(center+1,end);

        double dMin=Math.min(dLeft,dright);

        for(int i=center;i>=begin&&points[center].x-points[i].x<dMin;i--){
            for(int j=center+1;j<=end&&points[j].x-points[center].x<dMin;j++){
                if(Math.abs(points[i].y-points[j].y)<=dMin){
                    double distance=distance(points[i],points[j]);
                    if(distance<dMin){
                        dMin=distance;
                    }
                }
            }
        }

        return dMin;
    }
}
